{extend name="public:base" /}

{block name="css"}
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css"/>
<link href="__ADMIN__/css/style.css" rel="stylesheet">
{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label">订单信息</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="订单号：{$info.order_sn}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="总金额：{$info.all_price}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="支付金额：{$info.pay_price}" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row">
                            <label class="col-sm-1 col-form-label"></label>
                            <div class="col-sm-3">
                                <select class="form-control" disabled>
                                    <option value="1" {$info[
                                    'status'] == 1 ? 'selected' : ''}>订单状态：待付款</option>
                                    <option value="2" {$info[
                                    'status'] == 2 ? 'selected' : ''}>订单状态：待发货</option>
                                    <option value="3" {$info[
                                    'status'] == 3 ? 'selected' : ''}>订单状态：待收货</option>
                                    <option value="4" {$info[
                                    'status'] == 4 ? 'selected' : ''}>订单状态：待评价</option>
                                    <option value="5" {$info[
                                    'status'] == 5 ? 'selected' : ''}>订单状态：已完成</option>
                                    <option value="7" {$info[
                                    'status'] == 7 ? 'selected' : ''}>订单状态：售后中</option>
                                    <option value="8" {$info[
                                    'status'] == 8 ? 'selected' : ''}>订单状态：售后完成</option>
                                    <option value="10" {$info[
                                    'status'] == 10 ? 'selected' : ''}>订单状态：已取消</option>
                                </select>
                            </div>
                            <div class="col-sm-3">
                                <select class="form-control" disabled>
                                    <option value="0" {$info[
                                    'after_status'] == 0 && $info['after_status'] !='' ? 'selected' :
                                    ''}>订单售后状态：未售后</option>
                                    <option value="1" {$info[
                                    'after_status'] == 1 ? 'selected' : ''}>订单售后状态：售后中</option>
                                    <option value="2" {$info[
                                    'after_status'] == 2 ? 'selected' : ''}>订单售后状态：售后成功</option>
                                    <option value="3" {$info[
                                    'after_status'] == 3 ? 'selected' : ''}>订单售后状态：售后失败</option>
                                </select>
                            </div>

                            <div class="col-sm-3">
                                <select class="form-control" disabled>
                                    <option value="0" {$info[
                                    'is_pay'] == 0 && $info['is_pay'] !='' ? 'selected' : ''}>支付状态：未支付</option>
                                    <option value="1" {$info[
                                    'is_pay'] == 1 ? 'selected' : ''}>支付状态：已支付</option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label"></label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="支付时间：{$info.pay_time?timeFormat($info.pay_time):'未支付'}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货时间：{$info.complete_time?timeFormat($info.complete_time):'未收货'}" readonly>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="ibox ">
                <div class="ibox-content">
                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label">运输信息</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货人姓名：{$info.get_username}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货人手机号：{$info.get_mobile}" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label"></label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" value="收货人地址：{$info.get_province}{$info.get_city}{$info.get_area}{$info.get_address}" readonly>
                            </div>
                        </div>

                        {if $info.express_id}
                        <div class="form-group row"><label class="col-sm-1 col-form-label"></label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="快递公司：{$info.express_name}" readonly>
                            </div>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="快递单号：{$info.send_num}" readonly>
                            </div>
                        </div>
                        {/if}

                        <div class="hr-line-dashed"></div>
                    </div>


                </div>
            </div>

            <div class="ibox ">
                <div class="ibox-content ">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>商品名称</th>
                                <th>商品图片</th>
                                <th>商品属性</th>
                                <th>商品数量</th>
                                <th>单价</th>
                                <th>查看评论</th>
                                <th>赠品</th>

                            </tr>
                            </thead>
                            <tbody>
                            {volist name="order_vice" id="vo"}
                            <tr>
                                <td>{$vo.name}</td>
                                <td><img class="upload-file" src="{:getPicture($vo.img)}"></td>
                                <td>{$vo.suk_name_str}</td>
                                <td>{$vo.count}</td>
                                <td>{$vo.price}</td>
                                <td>
                                    {if condition="$vo['is_comment'] gt 0"}
                                    <a href="{:url('doComment', ['id' => $vo['is_comment'],])}" class="btn btn-white btn-sm">
                                        <i class="iconfont icon-edit"></i> 查看评论
                                    </a>
                                    {else/}
                                    暂未评论
                                    {/if}
                                </td>
                                <td class="gift" style="text-align: left">
                                    {volist name="vo['gift_arr']" id="vv"}
                                    <div class="gift-box">
                                        <img src="{:getPicture($vv.gift_img)}">
                                        <div class="gift-right">
                                            <div class="gift-font gift-name multiColumn" style="text-align: left">
                                                {$vv['gift_name']}
                                            </div>
                                            <div class="gift-font gift-price">￥{$vv['gift_price']}</div>
                                            <div class="gift-font gift-count">x1</div>
                                        </div>
                                    </div>
                                    {/volist}
                                </td>

                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>


            <!-- 发货信息-->
            {if condition="$info.status == 2"}
            <div class="ibox ">
                <div class="ibox-content ">
                    <form method="post">
                        <div class="ibox-content">
                            <div class="box-item">
                                <div class="form-group row">
                                    <label class="col-sm-1 col-form-label">快递公司</label>
                                    <div class="col-sm-3">
                                        <select class="form-control" name="express_id" {$info['status'] > 2 ? 'disabled'
                                        : ''}>
                                        {volist name="express_list" id="vv"}
                                        <option value="{$vv.id}" {$info[
                                        'express_id'] == $vv.id ? 'selected' : ''}>{$vv.name}</option>
                                        {/volist}
                                        </select>
                                    </div>
                                    <label class="col-sm-1 col-form-label">快递单号</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" name="send_num" value="{$info.send_num}" {$info['status']
                                        > 2 ? 'readonly' : ''}>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$info.id}"/>

                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">
                                    确认发货
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            {/if}

            <!-- 售后 订单-->
            {if condition="$info.status == 7"}
            <div class="ibox ">
                <div class="ibox-content ">
                    <form method="post">
                        <div class="ibox-content">
                            <div class="box-item">
                                <div class="form-group row"><label class="col-sm-1 col-form-label">售后操作</label>
                                    <div class="col-sm-3">
                                        <select class="form-control changeStatus" name="after_status" {if condition="$info.after_status gt 1" }disabled{/if}>
                                        <option value="0">请选择</option>
                                        <option value="2" {$info[
                                        'after_status'] == 2 ? 'selected' : ''}>成功</option>
                                        <option value="3" {$info[
                                        'after_status'] == 3 ? 'selected' : ''}>失败</option>
                                        </select>
                                    </div>

                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" value="售后类型：{$info.after_type}" readonly>
                                        <input type="hidden" value="{$info.after_type}" name="after_type">
                                    </div>

                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" value="售后原因：{$info.after_reason}" readonly>
                                    </div>


                                </div>
                            </div>

                            <div class="box-item">
                                <div class="form-group row">
                                    <label class="col-sm-1 col-form-label">售后描述</label>
                                    <div class="col-sm-3">
                                        <textarea class="form-control" readonly rows="8">{$info.after_desc}</textarea>
                                        <span class="form-text m-b-none"></span>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                            </div>

                            <div class="box-item after_reason" style="display: none">
                                <div class="form-group row">
                                    <label class="col-sm-1 col-form-label">拒绝原因</label>
                                    <div class="col-sm-3">
                                        <textarea class="form-control" name="after_refuse_reason" {if condition="$info.after_status gt 1" }readonly{/if}
                                        rows="8">{$info.after_refuse_reason}</textarea>
                                        <span class="form-text m-b-none"></span>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$info.id}"/>

                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">
                                    确认审核
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            {/if}
            <button type="button" class="btn btn-w-m btn-default back-page">返回</button>
        </div>
    </div>


    {/block}

    {block name="css"}
    <style>
        .multiColumn {
            display: -webkit-box;
            width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            word-wrap: break-word;
            white-space: normal !important;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
        }

        .gift-box {
            margin-top: 10px;
        }

        .gift {
            text-align: left;
            width: 300px;
        }

        .gift img {
            width: 40px;
            height: 40px;
            object-fit: cover;
            float: left;
            margin-left: 10px;
        }

        .gift-right {
            display: inline-block;
            margin-left: 10px;
        }

        .gift-name {
            /*text-align: left;*/
            float: right;
            width: 140px;
        }

        .gift-price {
            text-align: left;
            margin-top: 25px;
        }

        .gift-count {
            text-align: right;
            float: right;
            margin-top: -18px;
        }

        .gift-font {
            font-size: 12px;
        }
    </style>
    {/block}

    {block name='js'}
    <script src="/static/layui/layui.js"></script>
    <script src="/static/skuTable.js"></script>
    <script type="text/javascript" src="__PLUG__/kindeditor/kindeditor-all.js"></script>
    <script type="text/javascript">
        $(".changeStatus").change(function (e) {
            var after_status = $(this).val();
            if (after_status == 3) {
                $(".after_reason").show();
            } else {
                $(".after_reason").hide();
            }
            $(".after_reason").find('textarea').text('');
        })
    </script>
    {/block}